
baddata = read.table("count1.txt")
library(INLA)

# strong prior, this works
inlares = inla(y~f(group, model="iid", param=c(1, 0.001)), data=baddata, family="binomial", Ntrials=N, quantiles = c(0.025,0.975))

# weak prior, this fails
inlares = inla(y~f(group, model="iid", param=c(0.01, 0.001)), data=baddata, family="binomial", Ntrials=N, quantiles = c(0.025,0.975))



# try with winbugs
library(glmmBUGS)
forBugs = glmmBUGS(y + N ~ 1, family="binomial", data=baddata,effects="group")
source("getInits.R")
startingValues = forBugs$startingValues
library(R2WinBUGS)
bugsres = bugs(forBugs$ragged,getInits, "model.bug", debug=T, useWINE=T, working.directory=getwd(), parameters.to.save=names(getInits()) )


